#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#include "Blinker.h"

char auth[] = "38f9de8f8385";
char ssid[] = "gan";
char pswd[] = "12345678";

// 新建组件对象
BlinkerButton Button1("btn");
const int LED =4;

// 按下按键即会执行该函数
void button1_callback(const String & state) {
   if(state=="on")
   {
    digitalWrite(LED_BUILTIN, LOW);
    Button1.print("on");
   }else
   {
    digitalWrite(LED_BUILTIN, HIGH);
    Button1.print("off");
   }
}  

void setup() {
  // 初始化串口
    Serial.begin(115200);
    // 初始化有LED的IO
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, HIGH);
    // 初始化blinker
    Blinker.begin(auth, ssid, pswd);
    Button1.attach(button1_callback);
}

void loop() {
   Blinker.run();
}
